import { getrolelist } from '../../../request/api'

interface roleStore {
  rolelist: Array<Object>
}

const state = {
  rolelist: []
}

const getters = {
  getrole(state: roleStore) {
    return state.rolelist
  }
}

const mutations = {
  REQ_ROLE(state: roleStore, payload: any) {
    state.rolelist = payload
  }
}

const actions = {
  getroleActive({ commit }: any) {
    getrolelist().then((res: any) => {
      commit('REQ_ROLE', res.list)
    })
  }
}

export default {
  state,
  getters,
  mutations,
  actions,
  namespaced: true
}